<?php
//引入类库
include "./PHPExcel-1.8/Classes/PHPExcel/IOFactory.php";

//elsx文件路径
$inputFileName = "C:/Users/Administrator/Desktop/无悔华夏.xlsx";

date_default_timezone_set('PRC');
// 读取excel文件
try {
    $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    $objPHPExcel = $objReader->load($inputFileName);
}
catch (Exception $e) {
    echo $e -> errorInfo;
}

// 确定要读取的sheet，什么是sheet，看excel的右下角，真的不懂去百度吧
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();

// 获取excel文件的数据，$row=2代表从第二行开始获取数据
for ($row = 2; $row <= $highestRow; $row++) { // Read a row of data into an array
    $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); //这里得到的rowData都是一行的数据，得到数据后自行处理，我们这里只打出来看看效果
    echo '<pre>';
    var_dump($rowData);
    echo "<br>";
}
